﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WLMCoreLibrary;
using SAW_Core;
using System.Configuration;

namespace SAW
{
    public partial class printInvoice : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["idFactura"] != null)
            {
                dbConnector ConexionDB = new dbConnector();
                int idFactura = Convert.ToInt32(Request["idFactura"]);
                Factura factura = new Factura(idFactura,ref ConexionDB);
                FacturaSerie serie = new FacturaSerie(factura.idSerie,ref ConexionDB);
                string rutaFactura = serie.CarpetaRelativaCFD + factura.E_RFC + "/" + factura.Serie + "/" + factura.NoFolio.ToString("00000") + "/";
                Response.Write( WLMFunctions.TransformXML(ConfigurationManager.AppSettings["siteURL"]+rutaFactura+factura.ArchivoCFDXML,ConfigurationManager.AppSettings["siteURL"]+ "xsl/cfd/wlm.xsl"));

                ConexionDB.CloseConnection();
            }
        }
    }
}